//
//  NewTableHeaderView.m
//  Mtime
//
//  Created by Mac on 15/8/4.
//  Copyright (c) 2015年 wxk. All rights reserved.
//

#import "NewTableHeaderView.h"
#import "NewTableHeaderCVCell.h"

@implementation NewTableHeaderView
{

    IBOutlet UICollectionView *_collectionV;

}

- (void)setDataList:(NSMutableArray *)dataList {

    _dataList = dataList;

}

- (void)awakeFromNib {

    [super awakeFromNib];
    
    _collectionV.delegate = self;
    
    _collectionV.dataSource = self;
    
    _collectionV.pagingEnabled = YES;
    
    //注册单元格 ！！注册方法的调用对象为UICollectionView
//    [_collectionV registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    
    
    //注册xib／nib文件加载的单元格
    [_collectionV registerNib:[UINib nibWithNibName:@"NewTableHeaderCVCell" bundle:nil] forCellWithReuseIdentifier:@"cell"];
}

#pragma mark UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {

    return _dataList.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {

    NewTableHeaderCVCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    
    cell.model = _dataList[indexPath.item];
    
    return cell;
}


@end
